# -*- coding:utf-8 -*-

from server.action.batchBase import batchBase
from server.util import sqlBuild


class lrof(batchBase):  # 获取灯状态（关）
    @batchBase.idChecked
    def action(self, data, d):
        baId, lcId = data[0], data[2]

        sql = sqlBuild.sqlDict["update_lampClient_state"] % (0, lcId)
        self.db.update(sql)
        in_sql = sqlBuild.sqlDict["insert_onofListen_switch"] % (lcId, baId, 0, 1, baId)
        self.db.insert(in_sql)

        d.callback((2,))
